<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <meta>
  <!-- Stylesheets -->
  <link href="../web.css" type="text/css" rel="stylesheet"></link>
  <link href="../pygmentize.css" type="text/css" rel="stylesheet"></link>
  <title>VLFeat - Documentation - C API</title>
  <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>

  <!-- Scripts-->
  
 </meta>

 <!-- Body Start -->
 <body>
  <div id="header">
   <!-- Google CSE Search Box Begins -->
   <form action="http://www.vlfeat.org/search.html" method="get" id="cse-search-box" enctype="application/x-www-form-urlencoded">
    <div>
     <input type="hidden" name="cx" value="003215582122030917471:oq23albfeam"></input>
     <input type="hidden" name="cof" value="FORID:11"></input>
     <input type="hidden" name="ie" value="UTF-8"></input>
     <input type="text" name="q" size="31"></input>
     <input type="submit" name="sa" value="Search"></input>
    </div>
   </form>
   <script src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en" xml:space="preserve" type="text/javascript"></script>
   <!-- Google CSE Search Box Ends -->
   <h1><a shape="rect" href="../index.html" class="plain"><span id="vlfeat">VLFeat</span><span id="dotorg">.org</span></a></h1>
  </div>
  <div id="headbanner">
   Documentation - C API
  </div>
  <div id="pagebody">
   <div id="sidebar"> <!-- Navigation Start -->
    <ul>
<li><a href="../index.html">Home</a>
</li>
<li><a href="../download.html">Download</a>
</li>
<li><a href="../doc.html">Documentation</a>
<ul>
<li><a href="../mdoc/mdoc.html">Matlab API</a>
</li>
<li><a href="index.html" class='active' >C API</a>
</li>
<li><a href="../man/man.html">Man pages</a>
</li>
</ul></li>
<li><a href="../overview/tut.html">Tutorials</a>
</li>
<li><a href="../applications/apps.html">Applications</a>
</li>
</ul>

   </div> <!-- sidebar -->
   <div id="content">
    
    <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>
    <div class="doxygen">
<div>
<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a>  </div>
  <div class="headertitle">
<div class="title">aib.h File Reference</div>  </div>
</div>
<div class="contents">

<p>AIB (<a class="el" href="aib.html">Agglomerative Information Bottleneck (AIB)</a>)  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="generic_8h.html">generic.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="mathop_8h.html">mathop.h</a>&quot;</code><br/>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structVlAIB.html">VlAIB</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">AIB algorithm data.  <a href="structVlAIB.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Create and destroy</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structVlAIB.html">VlAIB</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8h.html#a4bb02325ebe150348976dbb46183f8f3">vl_aib_new</a> (double *Pcx, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> nvalues, <a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> nlabels)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates and initializes the internal data structure.  <a href="#a4bb02325ebe150348976dbb46183f8f3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8h.html#a145bb0e2d8f512613e8fd3fb92fe7ace">vl_aib_delete</a> (<a class="el" href="structVlAIB.html">VlAIB</a> *aib)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes AIB data structure.  <a href="#a145bb0e2d8f512613e8fd3fb92fe7ace"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">Process data</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8h.html#a2adbc69469a6200896e6582474c398ee">vl_aib_process</a> (<a class="el" href="structVlAIB.html">VlAIB</a> *aib)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Runs AIB on Pcx.  <a href="#a2adbc69469a6200896e6582474c398ee"></a><br/></td></tr>
<tr><td colspan="2"><div class="groupHeader">Retrieve results</div></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8h.html#ab5f34e685e826902284748f40328f27e">vl_aib_get_parents</a> (<a class="el" href="structVlAIB.html">VlAIB</a> const *aib)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get resulting list of parents.  <a href="#ab5f34e685e826902284748f40328f27e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">double *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aib_8h.html#a9fca2d098bd88a72132c5eca55db4f7b">vl_aib_get_costs</a> (<a class="el" href="structVlAIB.html">VlAIB</a> const *aib)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a list of merge costs.  <a href="#a9fca2d098bd88a72132c5eca55db4f7b"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><dl class="author"><dt><b>Author:</b></dt><dd>Brian Fulkerson </dd>
<dd>
Andrea Vedaldi </dd></dl>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a145bb0e2d8f512613e8fd3fb92fe7ace"></a><!-- doxytag: member="aib.h::vl_aib_delete" ref="a145bb0e2d8f512613e8fd3fb92fe7ace" args="(VlAIB *aib)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_aib_delete </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlAIB.html">VlAIB</a> *&#160;</td>
          <td class="paramname"><em>aib</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">aib</td><td>data structure to delete. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a9fca2d098bd88a72132c5eca55db4f7b"></a><!-- doxytag: member="aib.h::vl_aib_get_costs" ref="a9fca2d098bd88a72132c5eca55db4f7b" args="(VlAIB const *aib)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double * vl_aib_get_costs </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlAIB.html">VlAIB</a> const *&#160;</td>
          <td class="paramname"><em>aib</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">aib</td><td>AIB filter. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An array of costs </dd></dl>

</div>
</div>
<a class="anchor" id="ab5f34e685e826902284748f40328f27e"></a><!-- doxytag: member="aib.h::vl_aib_get_parents" ref="ab5f34e685e826902284748f40328f27e" args="(VlAIB const *aib)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a> * vl_aib_get_parents </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlAIB.html">VlAIB</a> const *&#160;</td>
          <td class="paramname"><em>aib</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">aib</td><td>AIB filter. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An array of parents </dd></dl>

</div>
</div>
<a class="anchor" id="a4bb02325ebe150348976dbb46183f8f3"></a><!-- doxytag: member="aib.h::vl_aib_new" ref="a4bb02325ebe150348976dbb46183f8f3" args="(double *Pcx, vl_uint nvalues, vl_uint nlabels)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structVlAIB.html">VlAIB</a>* vl_aib_new </td>
          <td>(</td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>Pcx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>nvalues</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a5bd6e91d6bfd0be04101fdca94069c92">vl_uint</a>&#160;</td>
          <td class="paramname"><em>nlabels</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">Pcx</td><td>A pointer to a 2D array of probabilities </td></tr>
    <tr><td class="paramname">nvalues</td><td>The number of rows in the array </td></tr>
    <tr><td class="paramname">nlabels</td><td>The number of columns in the array</td></tr>
  </table>
  </dd>
</dl>
<p>Creates a new <em><a class="el" href="structVlAIB.html" title="AIB algorithm data.">VlAIB</a></em> struct containing pointers to all the data that will be used during the AIB process.</p>
<p>Allocates memory for the following:</p>
<ul>
<li>Px (nvalues*sizeof(double))</li>
<li>Pc (nlabels*sizeof(double))</li>
<li>nodelist (nvalues*sizeof(vl_uint))</li>
<li>which (nvalues*sizeof(vl_uint))</li>
<li>beta (nvalues*sizeof(double))</li>
<li>bidx (nvalues*sizeof(vl_uint))</li>
<li>parents ((2*nvalues-1)*sizeof(vl_uint))</li>
<li>costs (nvalues*sizeof(double))</li>
</ul>
<p>Since it simply copies to pointer to Pcx, the total additional memory requirement is:</p>
<p>(3*nvalues+nlabels)*sizeof(double) + 4*nvalues*sizeof(vl_uint)</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>An allocated and initialized <em><a class="el" href="structVlAIB.html" title="AIB algorithm data.">VlAIB</a></em> pointer </dd></dl>

</div>
</div>
<a class="anchor" id="a2adbc69469a6200896e6582474c398ee"></a><!-- doxytag: member="aib.h::vl_aib_process" ref="a2adbc69469a6200896e6582474c398ee" args="(VlAIB *aib)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void vl_aib_process </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structVlAIB.html">VlAIB</a> *&#160;</td>
          <td class="paramname"><em>aib</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">aib</td><td>AIB object to process</td></tr>
  </table>
  </dd>
</dl>
<p>The function runs Agglomerative Information Bottleneck (AIB) on the joint probability table <em>aib-&gt;Pcx</em> which has labels along the columns and feature values along the rows. AIB iteratively merges the two values of the feature <code>x</code> that causes the smallest decrease in mutual information between the random variables <code>x</code> and <code>c</code>.</p>
<p>Merge operations are arranged in a binary tree. The nodes of the tree correspond to the original feature values and any other value obtained as a result of a merge operation. The nodes are indexed in breadth-first order, starting from the leaves. The first index is zero. In this way, the leaves correspond directly to the original feature values. In total there are <code>2*nvalues-1</code> nodes.</p>
<p>The results may be accessed through vl_aib_get_parents which returns an array with one element per tree node. Each element is the index the parent node. The root parent is equal to zero. The array has <code>2*nvalues-1</code> elements.</p>
<p>Feature values with null probability are ignored by the algorithm and their nodes have parents indexing a non-existent tree node (a value bigger than <code>2*nvalues-1</code>).</p>
<p>Then the function will also compute the information level after each merge. vl_get_costs will return a vector with the information level after each merge. <em>cost</em> has <code>nvalues</code> entries: The first is the value of the cost functional before any merge, and the others are the cost after the <code>nvalues-1</code> merges. </p>

</div>
</div>
</div>
     <!-- Doc Here -->
    </div>
   
   </div>
   <div class="clear">&nbsp;</div>
  </div> <!-- pagebody -->
  <div id="footer">
   &copy; 2007-12 Andrea Vedaldi and Brian Fulkerson
  </div> <!-- footer -->

  <!-- Google Analytics Begins -->
  <script xml:space="preserve" type="text/javascript">
   //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {
   var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
   document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
   }
   //]]>
  </script>
  <script xml:space="preserve" type="text/javascript">
    //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {

   try {
   var pageTracker = _gat._getTracker("UA-4936091-2");
   pageTracker._trackPageview();
   } catch(err) {}

   }
   //]]>
  </script>
  <!-- Google Analytics Ends -->
 </body>
</html>

 
